package com.futures.questionbank.fragment;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.futures.questionbank.R;
import com.futures.questionbank.Utils.SPUtil;
import com.futures.questionbank.Utils.UItils;
import com.futures.questionbank.base.BaseFragment;
import com.futures.questionbank.my.HelpActivity;
import com.futures.questionbank.my.OpintionActivity;
import com.futures.questionbank.my.SettingActivity;
import com.futures.questionbank.ui.home.CollectActivity;

import butterknife.BindView;
import butterknife.OnClick;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * author : huang
 * date   : 2020/6/15 0015 16:08
 * version: 1.0
 */
public class MyFragment extends BaseFragment {
    @BindView(R.id.iv_user)
    CircleImageView ivUser;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.ll_user)
    LinearLayout llUser;
    @BindView(R.id.tv_help)
    TextView tvHelp;
    @BindView(R.id.tv_share)
    TextView tvShare;
    @BindView(R.id.tv_setting)
    TextView tvSetting;
    @BindView(R.id.tv_about)
    TextView tvAbout;
    @BindView(R.id.sb_login)
    Button sbLogin;

    @Override
    protected int getLayoutResource() {
        return R.layout.my_fragment;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initView();
    }

    private void initView() {
        //根据 name 单个查询
        tvName.setText(SPUtil.getString("phone"));
    }

    @OnClick({R.id.tv_help, R.id.tv_share, R.id.tv_setting, R.id.tv_about, R.id.sb_login,R.id.tv_opinion})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_help:
                UItils.startActivity(HelpActivity.class);
                break;
            case R.id.tv_share:
                UItils.startActivity(CollectActivity.class);
                break;
            case R.id.tv_setting:
                UItils.startActivity(SettingActivity.class);
                break;
            case R.id.tv_about:
                break;
            case R.id.tv_opinion:
                UItils.startActivity(OpintionActivity.class);
                break;
            case R.id.sb_login:

                break;
                default:
        }
    }
}
